package com.cardetective.shopcar.page.activity.main

import android.util.Log
import androidx.annotation.DrawableRes
import androidx.fragment.app.Fragment
import com.app.ctzoverseas.page.main.home.HomeFragment
import com.blankj.utilcode.util.LogUtils
import com.cardetective.shopcar.R
import com.cardetective.shopcar.page.activity.main.mine.MineFragment
import com.cardetective.shopcar.page.activity.main.shopcar.ShopCarFragment
import com.cardetective.shopcar.page.activity.main.sort.SortFragment
import com.pinyuana.dragongame.CtzApplication


sealed class BottomNaviTab private constructor(
    val id: String,
    @DrawableRes
    val icon: Int,
    val name: String,
    val fragment: () -> Fragment
) {
    object Home : BottomNaviTab(
        "home",
        R.mipmap.bottom_bar_01_press,
        CtzApplication.appContext.getString(R.string.bottom_bar_01),
        { HomeFragment() }
    )

    object Profile : BottomNaviTab(
        "mine",
        R.mipmap.bottom_bar_04_press,
        CtzApplication.appContext.getString(R.string.bottom_bar_04),
        { MineFragment() }
    )

    companion object {
        val ALL: List<BottomNaviTab> = listOf(Home, Profile)

        fun findByPosition(index: Int): BottomNaviTab? = ALL.getOrNull(index)

        fun findById(tabId: String): BottomNaviTab? = ALL.find { it.id == tabId }
    }
}